<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

class Application_Models_WorkPeopleModel {

    private $_pkWorkPeople;
    private $_names;
    private $_lastNames;
    private $_document;
    private $_array = array();

    public function get_pkWorkPeople() {
        return $this->_pkWorkPeople;
    }

    public function get_names() {
        return $this->_names;
    }

    public function get_lastNames() {
        return $this->_lastNames;
    }

    public function get_document() {
        return $this->_document;
    }

    public function set_pkWorkPeople($_pkWorkPeople) {
        $this->_pkWorkPeople = $_pkWorkPeople;
    }

    public function set_names($_names) {
        $this->_names = $_names;
    }

    public function set_lastNames($_lastNames) {
        $this->_lastNames = $_lastNames;
    }

    public function set_document($_document) {
        $this->_document = $_document;
    }

    public function _listAllWorkPeople() {
        $db = new SuperDataBase();
        $query = "CALL sp_get_WorkPeopleNotUser()";
        $result = $db->executeQuery($query);
        $array = array();
        while ($row = $db->fecth_array($result)) {

            $array[] = array(
                "pkWorkPeople" => $row['pkWorkPeople'],
                'names' => $row['names'],
                "lastNames" => $row['lastNames'],
                "document" => $row['document'],
                'label'=>$row['lastNames']." ". $row['names'],
                'value'=>$row['pkWorkPeople']
                );
        }

        echo json_encode($array);
    }

}
